package stack;

import java.util.Stack;

/**
 * @author swing
 * @description
 * @create 2022 - 11 - 21 22:35
 */
public class StackTest {
    public static void main(String[] args) throws Exception {
        Stack<String> strings = new Stack<>();
        strings.push("1");
        strings.push("2");
        strings.push("3");
        strings.push("4");
        strings.pop();

        for (String str: strings
             ) {
            System.out.println(strings);
        }
        Stack1<String> stack = new Stack1<>();
        stack.push("a");
        stack.push("b");
        stack.push("c");
        stack.push("d");
        for (String str : stack) {
            System.out.print(str+" ");
        }
        System.out.println("-----------------------------");
        String result = stack.pop();
        System.out.println(stack.iterator());
        System.out.println("弹出了元素："+result);
        System.out.println(stack.size());
    }
}
